package work.parabola.keyboardswitch.pojo.query.plate;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import work.parabola.keyboardswitch.common.ResponseCode;
import work.parabola.keyboardswitch.common.ServerResponse;

@Data
@ToString
@EqualsAndHashCode
public class ResizeQuery {

    private Integer id;

    private Integer row;

    private Integer col;

    public ServerResponse validate() {
        if (this.id == null || this.row == null || this.col == null ||
                this.row.compareTo(0) <= 0 || this.col.compareTo(0) <= 0) {
            return ServerResponse.createByErrorCodeMessage(ResponseCode.ILLEGAL_ARGUMENT.getCode(),
                    ResponseCode.ILLEGAL_ARGUMENT.getDesc());
        }
        return ServerResponse.createBySuccess();
    }
}
